package com.show.web;

import com.show.entity.User;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import java.util.Date;

@Controller
@RequestMapping("/user")
public class UserController {

    @RequestMapping("/save.do")
    public String save(){
        System.out.println("save......");
        return "success";
    }

    @RequestMapping("/update.do")
    public String update(int id,String name){
        System.out.println(id);
        System.out.println(name);
        return "success";
    }

    @RequestMapping("/update1.do")
    public String update1(@RequestParam("id") int id,@RequestParam("username") String name){
        System.out.println(id);
        System.out.println(name);
        return "success";
    }

    @RequestMapping("/update2.do")
    public String update2(User user){
        System.out.println(user);
        return "success";
    }

    @RequestMapping("/update3.do")
    public String update3(User user){
        System.out.println(user);
        return "success";
    }

    @RequestMapping("/search.do")
    public String search(HttpServletRequest request, HttpServletResponse response, HttpSession session){
        System.out.println(request);
        System.out.println(response);
        System.out.println(session);
        return "success";
    }

    @RequestMapping("/searchByDate.do")
    public String searchByDate(String date){
        System.out.println(date);
        return "success";
    }

    @RequestMapping("/searchByDate2.do")
    public String searchByDate2(Date date){
        System.out.println(date);
        return "success";
    }
}
